home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2006 May / PCWMAY06.iso / Software / Resources / Partition Logic 0.61 / partlogic-0.61.iso / system / headers / sys / device.h < prev    next >
Text File  |  2006-01-31  |  3KB  |  101 lines

  1. // 
  2. //  Visopsys
  3. //  Copyright (C) 1998-2006 J. Andrew McLaughlin
  4. //  
  5. //  This library is free software; you can redistribute it and/or modify it
  6. //  under the terms of the GNU Lesser General Public License as published by
  7. //  the Free Software Foundation; either version 2.1 of the License, or (at
  8. //  your option) any later version.
  9. //
  10. //  This library is distributed in the hope that it will be useful, but
  11. //  WITHOUT ANY WARRANTY; without even the implied warranty of
  12. //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
  13. //  General Public License for more details.
  14. //
  15. //  You should have received a copy of the GNU Lesser General Public License
  16. //  along with this library; if not, write to the Free Software Foundation,
  17. //  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. //
  19. //  device.h
  20. //
  21.  
  22. // This file contains definitions and structures for using Visopsys hardware
  23. // devices
  24.  
  25. #if !defined(_DEVICE_H)
  26.  
  27. #define DEV_CLASSNAME_MAX                   32
  28. #define DEV_MODELNAME_MAX                   32
  29.  
  30. // Hardware device classes and subclasses
  31. #define DEVICECLASS_NONE                    0
  32. #define DEVICECLASS_SYSTEM                  0x0100
  33. #define DEVICECLASS_CPU                     0x0200
  34. #define DEVICECLASS_MEMORY                  0x0300
  35. #define DEVICECLASS_BUS                     0x0400
  36. #define DEVICECLASS_PIC                     0x0500
  37. #define DEVICECLASS_SYSTIMER                0x0600
  38. #define DEVICECLASS_RTC                     0x0700
  39. #define DEVICECLASS_DMA                     0x0800
  40. #define DEVICECLASS_KEYBOARD                0x0900
  41. #define DEVICECLASS_MOUSE                   0x0A00
  42. #define DEVICECLASS_DISK                    0x0B00
  43. #define DEVICECLASS_GRAPHIC                 0x0C00
  44. #define DEVICECLASS_NETWORK                 0x0D00
  45.  
  46. // Device sub-classes
  47.  
  48. // Sub-classes of CPUs
  49. #define DEVICESUBCLASS_NONE                 0
  50.  
  51. #define DEVICESUBCLASS_CPU_X86              (DEVICECLASS_CPU | 0x01)
  52.  
  53. // Sub-classes of buses
  54. #define DEVICESUBCLASS_BUS_PCI              (DEVICECLASS_BUS | 0x01)
  55.  
  56. // Sub-classes of mice
  57. #define DEVICESUBCLASS_MOUSE_PS2            (DEVICECLASS_MOUSE | 0x01)
  58. #define DEVICESUBCLASS_MOUSE_SERIAL         (DEVICECLASS_MOUSE | 0x02)
  59.  
  60. // Sub-classes of disks
  61. #define DEVICESUBCLASS_DISK_FLOPPY          (DEVICECLASS_DISK | 0x01)
  62. #define DEVICESUBCLASS_DISK_IDE             (DEVICECLASS_DISK | 0x02)
  63. #define DEVICESUBCLASS_DISK_SCSI            (DEVICECLASS_DISK | 0x03)
  64.  
  65. // Sub-classes of graphics adapters
  66. #define DEVICESUBCLASS_GRAPHIC_FRAMEBUFFER  (DEVICECLASS_GRAPHIC | 0x01)
  67.  
  68. // Sub-classes of network adapters
  69. #define DEVICESUBCLASS_NETWORK_ETHERNET     (DEVICECLASS_NETWORK | 0x01)
  70.  
  71. // For masking off class/subclass
  72. #define DEVICECLASS_MASK                    0xFF00
  73. #define DEVICESUBCLASS_MASK                 0x00FF
  74.  
  75. // A structure for device classes and subclasses, which just allows us to
  76. // associate the different types with string names.
  77. typedef struct {
  78.   int class;
  79.   char name[DEV_CLASSNAME_MAX];
  80.  
  81. } deviceClass;
  82.  
  83. // The generic hardware device structure
  84. typedef struct {
  85.   // Device class and subclass.  Subclass optional.
  86.   deviceClass class;
  87.   deviceClass subClass;
  88.  
  89.   // Optional, vendor-specific model name
  90.   char model[DEV_MODELNAME_MAX];
  91.  
  92.   // Used for maintaining the list of devices as a tree
  93.   void *parent;
  94.   void *firstChild;
  95.   void *next;
  96.  
  97. } device;
  98.  
  99. #define _DEVICE_H
  100. #endif
  101.